//
//  UCShortName.swift
//  UICreate
//
//  Created by JY_NEW on 2022/1/17.
//

import UIKit

/// 竖向滚动
public func vscroll(_ settings: UCSetting<UIScrollView>..., @UCBuilder build builder: () -> UCBuildable) -> UIScrollView {
    let scrollView = UIScrollView()
    scrollView.set(animated: 0, settings: settings)
    let contentView = UIView(.bg(.clear))
    scrollView.add(contentView, layout: .edges, .width)
    contentView.build(builder)
    return scrollView
}
/// 横向滚动
public func hscroll(_ settings: UCSetting<UIScrollView>..., @UCBuilder build builder: () -> UCBuildable) -> UIScrollView {
    let scrollView = UIScrollView()
    scrollView.set(animated: 0, settings: settings)
    let contentView = UIView(.bg(.clear))
    scrollView.add(contentView, layout: .edges, .height)
    contentView.build(builder)
    return scrollView
}
/// 竖向布局，默认distribution = .fill，alignment = .fill
public func vstack(_ settings: UCSetting<UIStackView>..., @UCBuilder build builder: () -> UCBuildable) -> UIStackView {
    let view = UIStackView(.axis(.vertical), .distribution(.fill), .alignment(.fill))
    view.set(animated: 0, settings: settings)
    view.build(builder)
    return view
}
/// 横向布局，默认distribution = .fill，alignment = .fill
public func hstack(_ settings: UCSetting<UIStackView>..., @UCBuilder build builder: () -> UCBuildable) -> UIStackView {
    let view = UIStackView(.axis(.horizontal), .distribution(.fill), .alignment(.fill))
    view.set(animated: 0, settings: settings)
    view.build(builder)
    return view
}
